
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>K8s安装与部署 · AGou's StudyNote</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="AGou">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism-tomorrow.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-insert-logo/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-lightbox/css/lightbox.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../../Git/" />
    
    
    <link rel="prev" href="K8s基础知识.html" />
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"repo":"AGou-ops/myStudyNote","types":["star","watch","fork"],"size":"small"};
    </script>

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://agou-ops.github.io" target="_blank" class="custom-link">◆点击进入我的个人博客</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                        <b>1.1.</b>
                    
                    关于我
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../Program_lang/">
            
                <a href="../../Program_lang/">
            
                    
                        <b>1.2.</b>
                    
                    编程语言
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../../Program_lang/Python.html">
            
                <a href="../../Program_lang/Python.html">
            
                    
                        <b>1.2.1.</b>
                    
                    Python
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../../Program_lang/Java.html">
            
                <a href="../../Program_lang/Java.html">
            
                    
                        <b>1.2.2.</b>
                    
                    Java
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../../Program_lang/Splash_Lua.html">
            
                <a href="../../Program_lang/Splash_Lua.html">
            
                    
                        <b>1.2.3.</b>
                    
                    Splash_Lua
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../../Database/">
            
                <a href="../../Database/">
            
                    
                        <b>1.3.</b>
                    
                    数据库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../../Database/Mysql、MariaDB/README.md">
            
                <span>
            
                    
                        <b>1.3.1.</b>
                    
                    Mysql/MariaDB
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1.1" data-path="../../Database/Mysql、MariaDB/MySQL、MariaDB基础.html">
            
                <a href="../../Database/Mysql、MariaDB/MySQL、MariaDB基础.html">
            
                    
                        <b>1.3.1.1.</b>
                    
                    MySQL/MariaDB基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.2" data-path="../../Database/Mysql、MariaDB/php-mysql.html">
            
                <a href="../../Database/Mysql、MariaDB/php-mysql.html">
            
                    
                        <b>1.3.1.2.</b>
                    
                    php-mysql
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../../Database/MongoDB.html">
            
                <a href="../../Database/MongoDB.html">
            
                    
                        <b>1.3.2.</b>
                    
                    MongoDB
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../../Database/Redis.html">
            
                <a href="../../Database/Redis.html">
            
                    
                        <b>1.3.3.</b>
                    
                    Redis
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../../Linux/">
            
                <a href="../../Linux/">
            
                    
                        <b>1.4.</b>
                    
                    Linux
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../../Linux/Linux基础.html">
            
                <a href="../../Linux/Linux基础.html">
            
                    
                        <b>1.4.1.</b>
                    
                    Linux基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../../Linux/Linux启动流程、内核、grub、模块、内核的编译、anaconda自动化.html">
            
                <a href="../../Linux/Linux启动流程、内核、grub、模块、内核的编译、anaconda自动化.html">
            
                    
                        <b>1.4.2.</b>
                    
                    Linux启动流程、内核、grub、模块等
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../../Linux/Linux服务器.html">
            
                <a href="../../Linux/Linux服务器.html">
            
                    
                        <b>1.4.3.</b>
                    
                    Linux服务器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../../Linux/Linux状态信息.html">
            
                <a href="../../Linux/Linux状态信息.html">
            
                    
                        <b>1.4.4.</b>
                    
                    Linux状态信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../../Linux/Linux网络客户端工具.html">
            
                <a href="../../Linux/Linux网络客户端工具.html">
            
                    
                        <b>1.4.5.</b>
                    
                    Linux网络客户端工具
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../../Linux/Linux网络配置.html">
            
                <a href="../../Linux/Linux网络配置.html">
            
                    
                        <b>1.4.6.</b>
                    
                    Linux网络配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../../Linux/Linux配置文件.md">
            
                <span>
            
                    
                        <b>1.4.7.</b>
                    
                    Linux配置文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../../Linux/Linux时间服务器.html">
            
                <a href="../../Linux/Linux时间服务器.html">
            
                    
                        <b>1.4.8.</b>
                    
                    Linux时间服务器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../../Linux/Linux日志管理系统.html">
            
                <a href="../../Linux/Linux日志管理系统.html">
            
                    
                        <b>1.4.9.</b>
                    
                    Linux日志管理系统
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../../Linux/sudo详解.html">
            
                <a href="../../Linux/sudo详解.html">
            
                    
                        <b>1.4.10.</b>
                    
                    sudo详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11" data-path="../../Linux/SElinux.html">
            
                <a href="../../Linux/SElinux.html">
            
                    
                        <b>1.4.11.</b>
                    
                    SELinux
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.12" data-path="../../Linux/iptables.html">
            
                <a href="../../Linux/iptables.html">
            
                    
                        <b>1.4.12.</b>
                    
                    iptables
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.13" data-path="../../Linux/Linux_shell.html">
            
                <a href="../../Linux/Linux_shell.html">
            
                    
                        <b>1.4.13.</b>
                    
                    Linux Shell
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.14" data-path="../../Linux/shell_awk.html">
            
                <a href="../../Linux/shell_awk.html">
            
                    
                        <b>1.4.14.</b>
                    
                    shell_awk
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.15" data-path="../../Linux/OpenSSL、PKI搭建、算法.html">
            
                <a href="../../Linux/OpenSSL、PKI搭建、算法.html">
            
                    
                        <b>1.4.15.</b>
                    
                    OpenSSL、PKI搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.16" data-path="../../Linux/DNS服务器.html">
            
                <a href="../../Linux/DNS服务器.html">
            
                    
                        <b>1.4.16.</b>
                    
                    DNS服务器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.17" data-path="../../Linux/Frp内网穿透.html">
            
                <a href="../../Linux/Frp内网穿透.html">
            
                    
                        <b>1.4.17.</b>
                    
                    Frp内网穿透
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.18" data-path="../../Linux/Linux其他.md">
            
                <span>
            
                    
                        <b>1.4.18.</b>
                    
                    Linux其他
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../../Linux_FileSystem/">
            
                <a href="../../Linux_FileSystem/">
            
                    
                        <b>1.5.</b>
                    
                    Linux文件系统
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../../Linux_FileSystem/FTP.html">
            
                <a href="../../Linux_FileSystem/FTP.html">
            
                    
                        <b>1.5.1.</b>
                    
                    FTP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../../Linux_FileSystem/SAMBA.html">
            
                <a href="../../Linux_FileSystem/SAMBA.html">
            
                    
                        <b>1.5.2.</b>
                    
                    SAMBA
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../../Linux_Tools/">
            
                <a href="../../Linux_Tools/">
            
                    
                        <b>1.6.</b>
                    
                    Linux工具
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../../Linux_Tools/fzf工具.html">
            
                <a href="../../Linux_Tools/fzf工具.html">
            
                    
                        <b>1.6.1.</b>
                    
                    fzf工具
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../../Linux_Tools/工具集合.html">
            
                <a href="../../Linux_Tools/工具集合.html">
            
                    
                        <b>1.6.2.</b>
                    
                    Linux工具集合
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../../WEB_Server/">
            
                <a href="../../WEB_Server/">
            
                    
                        <b>1.7.</b>
                    
                    网站服务器
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../../WEB_Server/HTML基础.html">
            
                <a href="../../WEB_Server/HTML基础.html">
            
                    
                        <b>1.7.1.</b>
                    
                    HTML基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../../WEB_Server/WEB基础.html">
            
                <a href="../../WEB_Server/WEB基础.html">
            
                    
                        <b>1.7.2.</b>
                    
                    WEB基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../../WEB_Server/httpd.html">
            
                <a href="../../WEB_Server/httpd.html">
            
                    
                        <b>1.7.3.</b>
                    
                    httpd/Apache
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../../WEB_Server/httpd.conf文件详解.html">
            
                <a href="../../WEB_Server/httpd.conf文件详解.html">
            
                    
                        <b>1.7.4.</b>
                    
                    httpd.conf文件详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../../WEB_Server/Nginx.html">
            
                <a href="../../WEB_Server/Nginx.html">
            
                    
                        <b>1.7.5.</b>
                    
                    Nginx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../../WEB_Server/HTTP状态码-详情.html">
            
                <a href="../../WEB_Server/HTTP状态码-详情.html">
            
                    
                        <b>1.7.6.</b>
                    
                    HTTP状态码-详情
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../../Common_Framework/">
            
                <a href="../../Common_Framework/">
            
                    
                        <b>1.8.</b>
                    
                    常用框架
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../../Common_Framework/LNMP.html">
            
                <a href="../../Common_Framework/LNMP.html">
            
                    
                        <b>1.8.1.</b>
                    
                    LNMP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../../Common_Framework/LAMP.html">
            
                <a href="../../Common_Framework/LAMP.html">
            
                    
                        <b>1.8.2.</b>
                    
                    LAMP
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../">
            
                <a href="../">
            
                    
                        <b>1.9.</b>
                    
                    容器及容器编排
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../Docker/Docker.html">
            
                <a href="../Docker/Docker.html">
            
                    
                        <b>1.9.1.</b>
                    
                    Docker
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1.1" data-path="../Docker/Docker.html">
            
                <a href="../Docker/Docker.html">
            
                    
                        <b>1.9.1.1.</b>
                    
                    Docker
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="./">
            
                <a href="./">
            
                    
                        <b>1.9.2.</b>
                    
                    K8s
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.2.1" data-path="K8s基础知识.html">
            
                <a href="K8s基础知识.html">
            
                    
                        <b>1.9.2.1.</b>
                    
                    K8s基础知识
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.9.2.2" data-path="K8s安装与部署.html">
            
                <a href="K8s安装与部署.html">
            
                    
                        <b>1.9.2.2.</b>
                    
                    K8s安装与部署
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../../Git/">
            
                <a href="../../Git/">
            
                    
                        <b>1.10.</b>
                    
                    Git
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../../Git/Git基础.html">
            
                <a href="../../Git/Git基础.html">
            
                    
                        <b>1.10.1.</b>
                    
                    Git基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../../Git/GitLab服务器.html">
            
                <a href="../../Git/GitLab服务器.html">
            
                    
                        <b>1.10.2.</b>
                    
                    GitLab服务器
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../../Windows/">
            
                <a href="../../Windows/">
            
                    
                        <b>1.11.</b>
                    
                    Windows系统
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../../Windows/cmd命令.html">
            
                <a href="../../Windows/cmd命令.html">
            
                    
                        <b>1.11.1.</b>
                    
                    cmd命令
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../../Vim.html">
            
                <a href="../../Vim.html">
            
                    
                        <b>1.12.</b>
                    
                    Vim
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../../i3WM快捷键.html">
            
                <a href="../../i3WM快捷键.html">
            
                    
                        <b>1.13.</b>
                    
                    i3WM快捷键
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../../ADB命令.html">
            
                <a href="../../ADB命令.html">
            
                    
                        <b>1.14.</b>
                    
                    ADB命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../../Tmux.html">
            
                <a href="../../Tmux.html">
            
                    
                        <b>1.15.</b>
                    
                    Tmux
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="../../Kindle.html">
            
                <a href="../../Kindle.html">
            
                    
                        <b>1.16.</b>
                    
                    Kindle越狱指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="../../Other/">
            
                <a href="../../Other/">
            
                    
                        <b>1.17.</b>
                    
                    Other
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.17.1" data-path="../../Other/pandoc.html">
            
                <a href="../../Other/pandoc.html">
            
                    
                        <b>1.17.1.</b>
                    
                    pandoc
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.2" data-path="../../Other/jupyter&reveal.js.html">
            
                <a href="../../Other/jupyter&reveal.js.html">
            
                    
                        <b>1.17.2.</b>
                    
                    jupyter & reveal.js
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.3" data-path="../../Other/json.html">
            
                <a href="../../Other/json.html">
            
                    
                        <b>1.17.3.</b>
                    
                    json
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.4" data-path="../../Other/Reveal_js.html">
            
                <a href="../../Other/Reveal_js.html">
            
                    
                        <b>1.17.4.</b>
                    
                    Reveal_js
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >K8s安装与部署</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-anchor"></i><ul><li><a href="#k8s&#x7684;&#x5B89;&#x88C5;&#x4E0E;&#x90E8;&#x7F72;">1. K8s&#x7684;&#x5B89;&#x88C5;&#x4E0E;&#x90E8;&#x7F72;</a></li><ul><li><a href="#&#x4F7F;&#x7528;kubeadm&#x56FD;&#x5185;aliyun&#x955C;&#x50CF;">1.1. &#x4F7F;&#x7528;kubeadm(&#x56FD;&#x5185;Aliyun&#x955C;&#x50CF;)</a></li><ul><li><a href="#&#x4E00;&#x3001;&#x73AF;&#x5883;&#x51C6;&#x5907;&#x4E0E;&#x5B89;&#x88C5;">1.1.1. &#x4E00;&#x3001;&#x73AF;&#x5883;&#x51C6;&#x5907;&#x4E0E;&#x5B89;&#x88C5;</a></li><li><a href="#&#x4E8C;&#x3001;&#x521D;&#x59CB;&#x5316;master">1.1.2. &#x4E8C;&#x3001;&#x521D;&#x59CB;&#x5316;master</a></li><li><a href="#&#x4E09;&#x3001;&#x5C06;node&#x6DFB;&#x52A0;&#x8FDB;master&#x96C6;&#x7FA4;&#x4E2D;">1.1.3. &#x4E09;&#x3001;&#x5C06;node&#x6DFB;&#x52A0;&#x8FDB;master&#x96C6;&#x7FA4;&#x4E2D;</a></li><li><a href="#&#x6CE8;&#x610F;&#x4E8B;&#x9879;">1.1.4. &#x6CE8;&#x610F;&#x4E8B;&#x9879;</a></li></ul><li><a href="#&#x4E00;&#x952E;&#x5B89;&#x88C5;">1.2. &#x4E00;&#x952E;&#x5B89;&#x88C5;</a></li></ul></ul></div><a href="#k8s&#x7684;&#x5B89;&#x88C5;&#x4E0E;&#x90E8;&#x7F72;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="k8s&#x7684;&#x5B89;&#x88C5;&#x4E0E;&#x90E8;&#x7F72;"><a name="k8s&#x7684;&#x5B89;&#x88C5;&#x4E0E;&#x90E8;&#x7F72;" class="anchor-navigation-ex-anchor" href="#k8s&#x7684;&#x5B89;&#x88C5;&#x4E0E;&#x90E8;&#x7F72;"><i class="fa fa-link" aria-hidden="true"></i></a>1. K8s&#x7684;&#x5B89;&#x88C5;&#x4E0E;&#x90E8;&#x7F72;</h1>
<h2 id="&#x4F7F;&#x7528;kubeadm&#x56FD;&#x5185;aliyun&#x955C;&#x50CF;"><a name="&#x4F7F;&#x7528;kubeadm&#x56FD;&#x5185;aliyun&#x955C;&#x50CF;" class="anchor-navigation-ex-anchor" href="#&#x4F7F;&#x7528;kubeadm&#x56FD;&#x5185;aliyun&#x955C;&#x50CF;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1. &#x4F7F;&#x7528;kubeadm(&#x56FD;&#x5185;Aliyun&#x955C;&#x50CF;)</h2>
<h3 id="&#x4E00;&#x3001;&#x73AF;&#x5883;&#x51C6;&#x5907;&#x4E0E;&#x5B89;&#x88C5;"><a name="&#x4E00;&#x3001;&#x73AF;&#x5883;&#x51C6;&#x5907;&#x4E0E;&#x5B89;&#x88C5;" class="anchor-navigation-ex-anchor" href="#&#x4E00;&#x3001;&#x73AF;&#x5883;&#x51C6;&#x5907;&#x4E0E;&#x5B89;&#x88C5;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.1. &#x4E00;&#x3001;&#x73AF;&#x5883;&#x51C6;&#x5907;&#x4E0E;&#x5B89;&#x88C5;</h3>
<ol>
<li>&#x4E3A;&#x6BCF;&#x4E00;&#x53F0;&#x4E3B;&#x673A;&#x914D;&#x7F6E;hosts</li>
</ol>
<pre class="language-"><code class="lang-bash"><span class="token number">172.16</span>.122.128 master.suofeiya.com master
<span class="token number">172.16</span>.122.132 node1.suofeiya.com node1
<span class="token number">172.16</span>.122.133 node2.suofeiya.com node2
</code></pre>
<ol>
<li>&#x5F00;&#x542F;&#x900F;&#x660E;&#x7F51;&#x6865;</li>
</ol>
<pre class="language-"><code class="lang-bash"><span class="token builtin class-name">echo</span> <span class="token string">&quot;net.bridge.bridge-nf-call-iptables=1&quot;</span> <span class="token operator">&gt;&gt;</span> /etc/sysctl.conf
<span class="token comment"># &#x4FEE;&#x6539;/proc/sys/net/bridge/bridge-nf-call-iptables &#x7684;&#x503C;&#x4E5F;&#x53EF;&#x4EE5;</span>
<span class="token builtin class-name">echo</span> <span class="token string">&quot;net.bridge.bridge-nf-call-ip6tables=1&quot;</span> <span class="token operator">&gt;&gt;</span> /etc/sysctl.conf
sysctl -p
</code></pre>
<ol>
<li>&#x5728;k8s&#x65E9;&#x671F;&#x7248;&#x672C;&#xFF0C;&#x9700;&#x8981;&#x5173;&#x95ED;&#x7CFB;&#x7EDF;&#x7684;swap</li>
</ol>
<pre class="language-"><code class="lang-bash"><span class="token comment"># &#x6CE8;&#x91CA;&#x6389;&#x4EE5;&#x4E0B;&#x5185;&#x5BB9;&#xFF0C;&#x91CD;&#x542F;&#x673A;&#x5668;&#x5373;&#x53EF;</span>
/dev/mapper/centos-swap swap                    swap    defaults        <span class="token number">0</span> <span class="token number">0</span>
</code></pre>
<ol>
<li>&#x6DFB;&#x52A0;&#x963F;&#x91CC;&#x4E91;docker-ce&#x955C;&#x50CF;</li>
</ol>
<p><strong>Debian / Ubuntu</strong></p>
<pre class="language-"><code class="lang-bash"><span class="token comment"># step 1: &#x5B89;&#x88C5;&#x5FC5;&#x8981;&#x7684;&#x4E00;&#x4E9B;&#x7CFB;&#x7EDF;&#x5DE5;&#x5177;</span>
<span class="token function">sudo</span> <span class="token function">apt-get</span> update
<span class="token function">sudo</span> <span class="token function">apt-get</span> -y <span class="token function">install</span> apt-transport-https ca-certificates <span class="token function">curl</span> software-properties-common
<span class="token comment"># step 2: &#x5B89;&#x88C5;GPG&#x8BC1;&#x4E66;</span>
<span class="token function">curl</span> -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg <span class="token operator">|</span> <span class="token function">sudo</span> apt-key <span class="token function">add</span> -
<span class="token comment"># Step 3: &#x5199;&#x5165;&#x8F6F;&#x4EF6;&#x6E90;&#x4FE1;&#x606F;</span>
<span class="token function">sudo</span> add-apt-repository <span class="token string">&quot;deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu <span class="token variable"><span class="token variable">$(</span>lsb_release -cs<span class="token variable">)</span></span> stable&quot;</span>
<span class="token comment"># Step 4: &#x66F4;&#x65B0;&#x5E76;&#x5B89;&#x88C5;Docker-CE</span>
<span class="token function">sudo</span> <span class="token function">apt-get</span> -y update
<span class="token function">sudo</span> <span class="token function">apt-get</span> -y <span class="token function">install</span> docker-ce

<span class="token comment"># &#x5B89;&#x88C5;&#x6307;&#x5B9A;&#x7248;&#x672C;&#x7684;Docker-CE:</span>
<span class="token comment"># Step 1: &#x67E5;&#x627E;Docker-CE&#x7684;&#x7248;&#x672C;:</span>
<span class="token comment"># apt-cache madison docker-ce</span>
<span class="token comment">#   docker-ce | 17.03.1~ce-0~ubuntu-xenial | https://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages</span>
<span class="token comment">#   docker-ce | 17.03.0~ce-0~ubuntu-xenial | https://mirrors.aliyun.com/docker-ce/linux/ubuntu xenial/stable amd64 Packages</span>
<span class="token comment"># Step 2: &#x5B89;&#x88C5;&#x6307;&#x5B9A;&#x7248;&#x672C;&#x7684;Docker-CE: (VERSION&#x4F8B;&#x5982;&#x4E0A;&#x9762;&#x7684;17.03.1~ce-0~ubuntu-xenial)</span>
<span class="token comment"># sudo apt-get -y install docker-ce=[VERSION]</span>
</code></pre>
<p><strong>CentOS / RHEL / Fedora</strong></p>
<pre class="language-"><code class="lang-bash"><span class="token comment"># step 1: &#x5B89;&#x88C5;&#x5FC5;&#x8981;&#x7684;&#x4E00;&#x4E9B;&#x7CFB;&#x7EDF;&#x5DE5;&#x5177;</span>
<span class="token function">sudo</span> yum <span class="token function">install</span> -y yum-utils device-mapper-persistent-data lvm2
<span class="token comment"># Step 2: &#x6DFB;&#x52A0;&#x8F6F;&#x4EF6;&#x6E90;&#x4FE1;&#x606F;</span>
<span class="token function">sudo</span> yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
<span class="token comment"># Step 3: &#x66F4;&#x65B0;&#x5E76;&#x5B89;&#x88C5;Docker-CE</span>
<span class="token function">sudo</span> yum makecache fast

<span class="token comment"># &#x6CE8;&#x610F;&#xFF1A;</span>
<span class="token comment"># &#x5B98;&#x65B9;&#x8F6F;&#x4EF6;&#x6E90;&#x9ED8;&#x8BA4;&#x542F;&#x7528;&#x4E86;&#x6700;&#x65B0;&#x7684;&#x8F6F;&#x4EF6;&#xFF0C;&#x60A8;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x7F16;&#x8F91;&#x8F6F;&#x4EF6;&#x6E90;&#x7684;&#x65B9;&#x5F0F;&#x83B7;&#x53D6;&#x5404;&#x4E2A;&#x7248;&#x672C;&#x7684;&#x8F6F;&#x4EF6;&#x5305;&#x3002;&#x4F8B;&#x5982;&#x5B98;&#x65B9;&#x5E76;&#x6CA1;&#x6709;&#x5C06;&#x6D4B;&#x8BD5;&#x7248;&#x672C;&#x7684;&#x8F6F;&#x4EF6;&#x6E90;&#x7F6E;&#x4E3A;&#x53EF;&#x7528;&#xFF0C;&#x60A8;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4EE5;&#x4E0B;&#x65B9;&#x5F0F;&#x5F00;&#x542F;&#x3002;&#x540C;&#x7406;&#x53EF;&#x4EE5;&#x5F00;&#x542F;&#x5404;&#x79CD;&#x6D4B;&#x8BD5;&#x7248;&#x672C;&#x7B49;&#x3002;</span>
<span class="token comment"># vim /etc/yum.repos.d/docker-ee.repo</span>
<span class="token comment">#   &#x5C06;[docker-ce-test]&#x4E0B;&#x65B9;&#x7684;enabled=0&#x4FEE;&#x6539;&#x4E3A;enabled=1</span>
<span class="token comment">#</span>
<span class="token comment"># &#x5B89;&#x88C5;&#x6307;&#x5B9A;&#x7248;&#x672C;&#x7684;Docker-CE:</span>
<span class="token comment"># Step 1: &#x67E5;&#x627E;Docker-CE&#x7684;&#x7248;&#x672C;:</span>
<span class="token comment"># yum list docker-ce.x86_64 --showduplicates | sort -r</span>
<span class="token comment">#   Loading mirror speeds from cached hostfile</span>
<span class="token comment">#   Loaded plugins: branch, fastestmirror, langpacks</span>
<span class="token comment">#   docker-ce.x86_64            17.03.1.ce-1.el7.centos            docker-ce-stable</span>
<span class="token comment">#   docker-ce.x86_64            17.03.1.ce-1.el7.centos            @docker-ce-stable</span>
<span class="token comment">#   docker-ce.x86_64            17.03.0.ce-1.el7.centos            docker-ce-stable</span>
<span class="token comment">#   Available Packages</span>
<span class="token comment"># Step2: &#x5B89;&#x88C5;&#x6307;&#x5B9A;&#x7248;&#x672C;&#x7684;Docker-CE: (VERSION&#x4F8B;&#x5982;&#x4E0A;&#x9762;&#x7684;17.03.0.ce.1-1.el7.centos)</span>
<span class="token comment"># sudo yum -y install docker-ce-[VERSION]</span>
</code></pre>
<ol>
<li>&#x6DFB;&#x52A0;&#x963F;&#x91CC;&#x4E91;k8s&#x76F8;&#x5173;&#x955C;&#x50CF;</li>
</ol>
<p><strong>Debian / Ubuntu</strong></p>
<pre class="language-"><code class="lang-bash"><span class="token function">apt-get</span> update <span class="token operator">&amp;&amp;</span> <span class="token function">apt-get</span> <span class="token function">install</span> -y apt-transport-https
<span class="token function">curl</span> https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg <span class="token operator">|</span> apt-key <span class="token function">add</span> - 
<span class="token function">cat</span> <span class="token operator">&lt;&lt;</span>EOF <span class="token operator">&gt;</span>/etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
EOF
</code></pre>
<p><strong>CentOS / RHEL / Fedora</strong></p>
<pre class="language-"><code class="lang-bash"><span class="token function">cat</span> <span class="token operator">&lt;&lt;</span>EOF <span class="token operator">&gt;</span> /etc/yum.repos.d/kubernetes.repo
<span class="token punctuation">[</span>kubernetes<span class="token punctuation">]</span>
<span class="token assign-left variable">name</span><span class="token operator">=</span>Kubernetes
<span class="token assign-left variable">baseurl</span><span class="token operator">=</span>https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
<span class="token assign-left variable">enabled</span><span class="token operator">=</span><span class="token number">1</span>
<span class="token assign-left variable">gpgcheck</span><span class="token operator">=</span><span class="token number">1</span>
<span class="token assign-left variable">repo_gpgcheck</span><span class="token operator">=</span><span class="token number">1</span>
<span class="token assign-left variable">gpgkey</span><span class="token operator">=</span>https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
</code></pre>
<ol>
<li>&#x5B89;&#x88C5;docker-ce&#xFF0C;k8s&#x76F8;&#x5173;&#xFF08; kubelet kubeadm kubectl&#xFF09;&#xFF0C;&#x5E76;&#x8BBE;&#x7F6E;&#x4E3A;&#x5F00;&#x673A;&#x542F;&#x52A8;</li>
</ol>
<pre class="language-"><code class="lang-bash">yum <span class="token function">install</span> -y docker-ce kubelet kubeadm kubectl
systemctl <span class="token builtin class-name">enable</span> docker kubelet
</code></pre>
<h3 id="&#x4E8C;&#x3001;&#x521D;&#x59CB;&#x5316;master"><a name="&#x4E8C;&#x3001;&#x521D;&#x59CB;&#x5316;master" class="anchor-navigation-ex-anchor" href="#&#x4E8C;&#x3001;&#x521D;&#x59CB;&#x5316;master"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.2. &#x4E8C;&#x3001;&#x521D;&#x59CB;&#x5316;master</h3>
<pre class="language-"><code class="lang-bash">kubeadm init --kubernetes-version<span class="token operator">=</span>v1.17.0 --pod-network-cidr<span class="token operator">=</span><span class="token number">10.244</span>.0.0/16 --service-cidr<span class="token operator">=</span><span class="token number">10.96</span>.0.0/12
</code></pre>
<p>&#x5B8C;&#x6210;&#x4E4B;&#x540E;&#x4F1A;&#x6709;&#x4EE5;&#x4E0B;&#x63D0;&#x793A;&#x4FE1;&#x606F;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">Your Kubernetes control-plane has initialized successfully<span class="token operator">!</span>

To start using your cluster, you need to run the following as a regular user:
<span class="token comment"># ==========&#x624B;&#x52A8;&#x5B8C;&#x6210;==========</span>
  <span class="token function">mkdir</span> -p <span class="token environment constant">$HOME</span>/.kube
  <span class="token function">sudo</span> <span class="token function">cp</span> -i /etc/kubernetes/admin.conf <span class="token environment constant">$HOME</span>/.kube/config
  <span class="token function">sudo</span> <span class="token function">chown</span> <span class="token variable"><span class="token variable">$(</span><span class="token function">id</span> -u<span class="token variable">)</span></span><span class="token builtin class-name">:</span><span class="token variable"><span class="token variable">$(</span><span class="token function">id</span> -g<span class="token variable">)</span></span> <span class="token environment constant">$HOME</span>/.kube/config
<span class="token comment"># ===========================</span>
You should now deploy a pod network to the cluster.
Run <span class="token string">&quot;kubectl apply -f [podnetwork].yaml&quot;</span> with one of the options listed at:
  https://kubernetes.io/docs/concepts/cluster-administration/addons/

Then you can <span class="token function">join</span> any number of worker nodes by running the following on each as root:
<span class="token comment"># &#x8BB0;&#x5F55;&#x597D;&#x4E0B;&#x9762;&#x8FD9;&#x6761;&#x547D;&#x4EE4;&#xFF0C;&#x4EE5;&#x4FBF;node&#x8282;&#x70B9;&#x7684;&#x52A0;&#x5165;</span>
kubeadm <span class="token function">join</span> <span class="token number">172.16</span>.122.128:6443 --token a2i1tb.rcyxusi4wij2n9ec <span class="token punctuation">\</span>
    --discovery-token-ca-cert-hash sha256:8fccc1b289a2bc890686a89af7fd6cc4ccfd97e9fd02f92ffea8ed6cfc0eb5e9
</code></pre>
<p>&#x6B64;&#x65F6;&#x4F7F;&#x7528;<code>kubectl get nodes</code>&#x53D1;&#x73B0;<code>master</code>&#x8282;&#x70B9;&#x7684;&#x662F;<code>NotReady</code>&#x672A;&#x5C31;&#x7EEA;&#x72B6;&#x6001;</p>
<pre class="language-"><code class="lang-bash"><span class="token punctuation">[</span>root@master ~<span class="token punctuation">]</span><span class="token punctuation">\</span># kubectl get nodes
NAME     STATUS     ROLES    AGE    VERSION
master   NotReady   master   3h2m   v1.17.0
</code></pre>
<p>&#x56E0;&#x6B64;&#xFF0C;&#x6211;&#x4EEC;&#x8FD8;&#x9700;&#x8981;&#x5B89;&#x88C5;<code>fannel</code>&#x6765;&#x90E8;&#x7F72;k8s&#x7F51;&#x7EDC;&#xFF0C;&#x4EE5;&#x6FC0;&#x6D3B;&#x8282;&#x70B9;&#x3002;</p>
<p>&#x53BB;&#x5F80;<code>fannel</code><a href="https://github.com/coreos/flannel#deploying-flannel-manually" target="_blank">&#x5B98;&#x65B9;github&#x7AD9;&#x70B9;</a>&#xFF0C;&#x4F7F;&#x7528;&#x624B;&#x52A8;&#x90E8;&#x7F72;&#xFF08;k8s&#x7248;&#x672C;1.7+&#xFF09;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
</code></pre>
<p>&#x7B49;&#x5F85;docker&#x62C9;&#x53D6;&#x5B8C;&#x955C;&#x50CF;&#x4E4B;&#x540E;&#xFF0C;&#x518D;&#x6B21;&#x4F7F;&#x7528;<code>kubectl get nodes0</code>&#x5C31;&#x4F1A;&#x53D1;&#x73B0;<code>master</code>&#x8282;&#x70B9;&#x5DF2;&#x5C31;&#x7EEA;&#x3002;</p>
<hr>
<h4 id="init&#x65F6;&#x53EF;&#x80FD;&#x9047;&#x5230;&#x7684;&#x95EE;&#x9898;"><a name="init&#x65F6;&#x53EF;&#x80FD;&#x9047;&#x5230;&#x7684;&#x95EE;&#x9898;" class="anchor-navigation-ex-anchor" href="#init&#x65F6;&#x53EF;&#x80FD;&#x9047;&#x5230;&#x7684;&#x95EE;&#x9898;"><i class="fa fa-link" aria-hidden="true"></i></a>init&#x65F6;&#x53EF;&#x80FD;&#x9047;&#x5230;&#x7684;&#x95EE;&#x9898;</h4>
<ol>
<li><code>[WARNING IsDockerSystemdCheck]: detected &quot;cgroupfs&quot; as the Docker cgroup driver. The recommended driver is &quot;systemd&quot;.</code>&#xFF0C;&#x610F;&#x601D;&#x5C31;&#x662F;<code>[&#x8B66;&#x544A;IsDockerSystemdCheck]&#xFF1A;&#x68C0;&#x6D4B;&#x5230;&#x201C;cgroupfs&#x201D;&#x4F5C;&#x4E3A;Docker cgroup&#x9A71;&#x52A8;&#x7A0B;&#x5E8F;&#x3002; &#x63A8;&#x8350;&#x7684;&#x9A71;&#x52A8;&#x7A0B;&#x5E8F;&#x662F;&#x201C;systemd&#x201D;</code>&#x3002;&#x89E3;&#x51B3;&#x65B9;&#x6CD5;&#x5C31;&#x662F;&#x4FEE;&#x6539;docker&#x7684;&#x9A71;&#x52A8;&#x7684;&#x9A71;&#x52A8;&#x7A0B;&#x5E8F;&#x4E3A;<code>systemd</code>&#xFF0C;&#x5177;&#x4F53;&#x6B65;&#x9AA4;&#x5982;&#x4E0B;&#xFF1A;</li>
</ol>
<pre class="language-"><code class="lang-bash"><span class="token comment"># &#x7F16;&#x8F91;docker&#x914D;&#x7F6E;&#x6587;&#x4EF6;/etc/docker/daemon.json&#xFF0C;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x5219;&#x521B;&#x5EFA;</span>
<span class="token comment">####</span>
<span class="token punctuation">{</span>
<span class="token string">&quot;exec-opts&quot;</span>:<span class="token punctuation">[</span><span class="token string">&quot;native.cgroupdriver=systemd&quot;</span><span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token comment">####</span>
</code></pre>
<p>&#x7136;&#x540E;&#x91CD;&#x542F;docker&#x670D;&#x52A1;&#x5373;&#x53EF;</p>
<ol>
<li><code>[ERROR Swap]: running with swap on is not supported. Please disable swap</code>&#xFF0C;&#x610F;&#x601D;&#x662F;<code>&#x8FD0;&#x884C;&#x4E0D;&#x652F;&#x6301;swap&#xFF0C;&#x8BF7;&#x5173;&#x95ED;swap</code>&#xFF0C;&#x89E3;&#x51B3;&#x65B9;&#x6CD5;&#xFF1A;</li>
</ol>
<p>&#xFF08;1&#xFF09;&#x5173;&#x95ED;swap(&#x89C1;&#x73AF;&#x5883;&#x914D;&#x7F6E;)</p>
<p>&#xFF08;2&#xFF09;&#x5FFD;&#x7565;&#x8B66;&#x544A;</p>
<pre class="language-"><code class="lang-bash"><span class="token comment"># &#x2460;&#x7F16;&#x8F91;&#x914D;&#x7F6E;&#x6587;&#x4EF6;/etc/sysconfig/kubelet</span>
<span class="token comment">####</span>
<span class="token assign-left variable">KUBELET_EXTRA_ARGS</span><span class="token operator">=</span><span class="token string">&quot;--fail-swap-on=false&quot;</span>
<span class="token comment">####</span>
<span class="token comment"># &#x2461;&#x521D;&#x59CB;&#x5316;init&#x65F6;&#x6DFB;&#x52A0;`--ignore-preflight-errors=Swap`&#x53C2;&#x6570;</span>
</code></pre>
<p><strong>kubeadm init&#x65F6;&#xFF0C;&#x4F1A;&#x56E0;&#x4E3A;&#x65E0;&#x6CD5;&#x8BBF;&#x95EE;&#x5916;&#x7F51;&#xFF0C;&#x4ECE;&#x800C;&#x5BFC;&#x81F4;&#x955C;&#x50CF;&#x4E0B;&#x8F7D;&#x5931;&#x8D25;&#xFF0C;&#x89E3;&#x51B3;&#x65B9;&#x6CD5;&#x6709;&#x4EE5;&#x4E0B;&#x4E24;&#x79CD;&#xFF1A;</strong></p>
<p>&#xFF08;1&#xFF09;&#x914D;&#x7F6E;docker&#x4F7F;&#x7528;&#x4EE3;&#x7406;&#xFF08;&#x5DF2;&#x5931;&#x6548;&#xD7;&#xFF09;</p>
<pre class="language-"><code class="lang-bash"><span class="token function">vim</span> /usr/lib/systemd/system/docker.service
<span class="token comment">####</span>
<span class="token assign-left variable">Environment</span><span class="token operator">=</span><span class="token string">&quot;HTTPS_PROXY=http://www.ik8s.io:10080&quot;</span>
<span class="token assign-left variable">Environment</span><span class="token operator">=</span><span class="token string">&quot;NO_PROXY=127.0.0.0/8,172.16.122.0/16&quot;</span>
<span class="token comment">####</span>
</code></pre>
<p>&#xFF08;2&#xFF09;&#x63D0;&#x524D;&#x4ECE;&#x963F;&#x91CC;&#x4E91;&#x4E0B;&#x8F7D;&#x597D;&#x6240;&#x9700;&#x955C;&#x50CF;&#xFF0C;&#x5E76;&#x91CD;&#x65B0;&#x6253;&#x6807;</p>
<p>&#x4F7F;&#x7528;&#x811A;&#x672C;&#x81EA;&#x52A8;&#x5B8C;&#x6210;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash"><span class="token punctuation">[</span>root@master scripts<span class="token punctuation">]</span><span class="token comment"># cat get_k8s_img_from_aliyun.sh</span>
<span class="token comment">#!/bin/bash</span>
<span class="token comment"># need get images</span>
<span class="token assign-left variable">images</span><span class="token operator">=</span><span class="token punctuation">(</span>
k8s.gcr.io/kube-apiserver:v1.17.0
k8s.gcr.io/kube-controller-manager:v1.17.0
k8s.gcr.io/kube-scheduler:v1.17.0
k8s.gcr.io/kube-proxy:v1.17.0
k8s.gcr.io/pause:3.1
k8s.gcr.io/etcd:3.4.3-0
k8s.gcr.io/coredns:1.6.5
<span class="token punctuation">)</span>
<span class="token assign-left variable">k8s_registry</span><span class="token operator">=</span>k8s.gcr.io
<span class="token assign-left variable">aliyun_registry</span><span class="token operator">=</span>registry.cn-hangzhou.aliyuncs.com
<span class="token comment"># get images from aliyun registry</span>
<span class="token keyword">function</span> <span class="token function-name function">get_aliyun_k8s_images</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token keyword">for</span> <span class="token for-or-select variable">k8s_image</span> <span class="token keyword">in</span> <span class="token variable">${images<span class="token punctuation">[</span>*<span class="token punctuation">]</span>}</span><span class="token punctuation">;</span><span class="token keyword">do</span>
<span class="token assign-left variable">image</span><span class="token operator">=</span><span class="token variable"><span class="token variable">`</span> <span class="token builtin class-name">echo</span> $k8s_image <span class="token operator">|</span> <span class="token function">awk</span> -F <span class="token string">&apos;/&apos;</span> <span class="token string">&apos;{print <span class="token variable">$2</span>}&apos;</span><span class="token variable">`</span></span>
docker pull <span class="token variable">$aliyun_registry</span>/google_containers/<span class="token variable">$image</span>
<span class="token keyword">done</span>
<span class="token punctuation">}</span>
<span class="token comment"># tag images to k8s.gcr.io registry</span>
<span class="token keyword">function</span> <span class="token function-name function">tag_images</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token keyword">for</span> <span class="token for-or-select variable">k8s_image</span> <span class="token keyword">in</span> <span class="token variable">${images<span class="token punctuation">[</span>*<span class="token punctuation">]</span>}</span><span class="token punctuation">;</span><span class="token keyword">do</span>
<span class="token assign-left variable">image</span><span class="token operator">=</span><span class="token variable"><span class="token variable">`</span> <span class="token builtin class-name">echo</span> $k8s_image <span class="token operator">|</span> <span class="token function">awk</span> -F <span class="token string">&apos;/&apos;</span> <span class="token string">&apos;{print <span class="token variable">$2</span>}&apos;</span><span class="token variable">`</span></span>
docker tag <span class="token variable">$aliyun_registry</span>/google_containers/<span class="token variable">$image</span> <span class="token variable">$k8s_registry</span>/<span class="token variable">$image</span>
<span class="token keyword">done</span>
<span class="token punctuation">}</span>
get_aliyun_k8s_images
tag_images
docker pull quay.io/coreos/flannel:v0.11.0-amd64
docker images
</code></pre>
<h3 id="&#x4E09;&#x3001;&#x5C06;node&#x6DFB;&#x52A0;&#x8FDB;master&#x96C6;&#x7FA4;&#x4E2D;"><a name="&#x4E09;&#x3001;&#x5C06;node&#x6DFB;&#x52A0;&#x8FDB;master&#x96C6;&#x7FA4;&#x4E2D;" class="anchor-navigation-ex-anchor" href="#&#x4E09;&#x3001;&#x5C06;node&#x6DFB;&#x52A0;&#x8FDB;master&#x96C6;&#x7FA4;&#x4E2D;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.3. &#x4E09;&#x3001;&#x5C06;node&#x6DFB;&#x52A0;&#x8FDB;master&#x96C6;&#x7FA4;&#x4E2D;</h3>
<p>node&#x8282;&#x70B9;&#x9700;&#x8981;&#x51C6;&#x5907;&#x4EE5;&#x4E0B;&#x4E09;&#x4E2A;&#x955C;&#x50CF;&#xFF08;&#x56FD;&#x5185;&#x6709;&#x5899;&#x624D;&#x9700;&#x8981;&#x9884;&#x5148;&#x4E0B;&#x8F7D;&#xFF09;</p>
<pre class="language-"><code class="lang-bash">k8s.gcr.io/kube-proxy:v1.17.0
k8s.gcr.io/pause:3.1
quay.io/coreos/flannel:v0.11.0-amd64
</code></pre>
<p>&#x62C9;&#x53D6;&#x5B8C;&#x540E;&#x4F7F;&#x7528;<code>kubeadm join</code>&#x5373;&#x53EF;</p>
<pre class="language-"><code class="lang-bash">kubeadm <span class="token function">join</span> <span class="token number">172.16</span>.122.128:6443 --token a2i1tb.rcyxusi4wij2n9ec <span class="token punctuation">\</span>
    --discovery-token-ca-cert-hash sha256:8fccc1b289a2bc890686a89af7fd6cc4ccfd97e9fd02f92ffea8ed6cfc0eb5e9 --ignore-preflight-errors<span class="token operator">=</span>Swap
</code></pre>
<p>&#x63A5;&#x7740;&#x5728;master&#x8282;&#x70B9;&#x4E0A;&#x67E5;&#x770B;pod&#x76F8;&#x5173;&#x4FE1;&#x606F;</p>
<pre class="language-"><code class="lang-bash"><span class="token punctuation">[</span>root@master ~<span class="token punctuation">]</span><span class="token punctuation">\</span># kubectl get nodes
NAME     STATUS   ROLES    AGE     VERSION
master   Ready    master   3h29m   v1.17.0
node1    Ready    <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>   3m26s   v1.17.0
</code></pre>
<p>node1&#x8282;&#x70B9;&#x5DF2;&#x6210;&#x529F;&#x52A0;&#x5165;&#x5E76;&#x5904;&#x4E8E;&#x5C31;&#x7EEA;&#x72B6;&#x6001;&#xFF0C;&#x8BF4;&#x660E;node1&#x52A0;&#x5165;&#x96C6;&#x7FA4;&#x6210;&#x529F;</p>
<h3 id="&#x6CE8;&#x610F;&#x4E8B;&#x9879;"><a name="&#x6CE8;&#x610F;&#x4E8B;&#x9879;" class="anchor-navigation-ex-anchor" href="#&#x6CE8;&#x610F;&#x4E8B;&#x9879;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1.4. &#x6CE8;&#x610F;&#x4E8B;&#x9879;</h3>
<ol>
<li>master&#x548C;node&#x8282;&#x70B9;&#x4E0A;&#x5982;&#x679C;<code>kubeadm</code>&#x6267;&#x884C;&#x4E0D;&#x6210;&#x529F;&#xFF0C;&#x6216;&#x8005;&#x9700;&#x8981;&#x91CD;&#x65B0;&#x6267;&#x884C;&#xFF0C;&#x9700;&#x8981;&#x5148;&#x4F7F;&#x7528;<code>kubeadm reset</code>&#x6062;&#x590D;&#x521D;&#x59CB;&#x72B6;&#x6001;</li>
<li>master&#x548C;node&#x8282;&#x70B9;&#x4E0A;&#x7684;<code>kubelet</code>&#x9700;&#x8981;&#x8BBE;&#x7F6E;&#x4E3A;&#x81EA;&#x542F;&#x52A8;&#xFF0C;&#x5426;&#x5219;&#x4E3B;&#x673A;&#x91CD;&#x542F;&#x540E;&#x7EC4;&#x4EF6;&#x7C7B;&#x5BB9;&#x5668;&#x4E0D;&#x80FD;&#x542F;&#x52A8;</li>
</ol>
<h2 id="&#x4E00;&#x952E;&#x5B89;&#x88C5;"><a name="&#x4E00;&#x952E;&#x5B89;&#x88C5;" class="anchor-navigation-ex-anchor" href="#&#x4E00;&#x952E;&#x5B89;&#x88C5;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2. &#x4E00;&#x952E;&#x5B89;&#x88C5;</h2>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; AGou 2020 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2020-03-02 20:42:24
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="K8s基础知识.html" class="navigation navigation-prev " aria-label="Previous page: K8s基础知识">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../../Git/" class="navigation navigation-next " aria-label="Next page: Git">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"K8s安装与部署","level":"1.9.2.2","depth":3,"next":{"title":"Git","level":"1.10","depth":1,"path":"Git/README.md","ref":"Git/README.md","articles":[{"title":"Git基础","level":"1.10.1","depth":2,"path":"Git/Git基础.md","ref":"Git/Git基础.md","articles":[]},{"title":"GitLab服务器","level":"1.10.2","depth":2,"path":"Git/GitLab服务器.md","ref":"Git/GitLab服务器.md","articles":[]}]},"previous":{"title":"K8s基础知识","level":"1.9.2.1","depth":3,"path":"Docker&K8s/K8s/K8s基础知识.md","ref":"Docker&K8s/K8s/K8s基础知识.md","articles":[]},"dir":"ltr"},"config":{"plugins":["github@^2.0.0","edit-link@^2.0.2","anchors@^0.7.1","include-codeblock@^3.0.2","tbfed-pagefooter@^0.0.1","expandable-chapters-small@^0.1.7","anchor-navigation-ex@0.1.8","prism","-highlight","insert-logo","-lunr","-search","search-pro","splitter","lightbox","github-buttons","-sharing","sharing-plus","donate","code","-klipse","livereload"],"root":".","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright © AGou 2020","modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"prism":{"css":["prismjs/themes/prism-tomorrow.css"]},"github":{"url":"https://github.com/AGou-ops"},"livereload":{},"splitter":{},"search-pro":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"code":{"copyButtons":true},"donate":{"alipay":"https://agou-ops.github.io/images/alipay.png","alipayText":"支付宝打赏","button":"打赏","title":"","wechat":"https://agou-ops.github.io/images/wechatpay.png","wechatText":"微信打赏"},"fontsettings":{"theme":"white","family":"sans","size":2},"anchor-navigation-ex":{"isRewritePageTitle":true,"tocLevel1Icon":"fa fa-hand-o-right","tocLevel2Icon":"fa fa-hand-o-right","tocLevel3Icon":"fa fa-hand-o-right"},"lightbox":{"jquery":true,"sameUuid":false},"github-buttons":{"repo":"AGou-ops/myStudyNote","types":["star","watch","fork"],"size":"small"},"expandable-chapters-small":{},"include-codeblock":{"check":false,"edit":true,"fixlang":false,"lang":"","template":"ace","theme":"chrome","unindent":true},"sharing":{"qq":true,"all":["douban","facebook","google","hatenaBookmark","instapaper","linkedin","twitter","weibo","messenger","qq","qzone","viber","vk","weibo","pocket","stumbleupon","whatsapp"],"douban":false,"facebook":false,"weibo":true,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":false,"viber":false,"stumbleupon":false,"qzone":true,"linkedin":false},"edit-link":{"label":"Edit This Page","base":"https://github.com/AGou-ops/myStudyNote"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":true},"anchors":{},"insert-logo":{"style":"background: none; max-height: 50px; min-height: 50px","url":"https://s2.ax1x.com/2019/12/10/QBD0xO.jpg"}},"theme":"default","author":"AGou","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"AGou's StudyNote","language":"zh-hans","output.name":"site","links":{"sidebar":{"◆点击进入我的个人博客":"http://agou-ops.github.io"}},"gitbook":"3.2.3","description":"岂能尽如人意，但求无愧我心。"},"file":{"path":"Docker&K8s/K8s/K8s安装与部署.md","mtime":"2020-03-02T12:42:24.284Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-03-02T12:42:32.383Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-edit-link/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-insert-logo/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lightbox/js/lightbox.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

